import request from '../../request/index.js'


/**
 * @
 * 获取九宫格按钮
 */
export function getBtnBoxInfo(){
	let url = '/api/saleTypes/list'
	// let params = {code}
	return request.get(url)
}

/**
 * @
 * 获取轮播图
 */
export function getSwiperInfo(){
	let url = '/api/home/banner'
	// let params = {code}
	return request.get(url)
}

/**
 * @
 * 获取头条列表
 */
export function getHeadListInfo(){
	let url = '/api/mallType/list'
	// let params = {code}
	return request.get(url)
}

//点击导航进入页面，获取商品列表
export function getGoodsList(page,saleType){
	console.log(saleType)
    let url ='/api/saleTypes/BySaleTypeId'
	let params = {
		page,
		limit:6,
		saleType,
		type:0
	}
    return request.get(url,{params})
}

/**
 * @
 * 点击news获取商品列表
 */
export function getGoodsListFromNews(id,page){
	let url = `/api/mallType/queryMallGoods/${id}/${page}/6`
	return request.get(url)
}

/**
 * @
 * 主页获取商品列表
 */
export function getHomeGoodsList(page,id){
	let url = '/api/goods/list'
	let params = {
		limit:8,
		page,
		type:id?id:null
	}
	return request.get(url,{params})
}

// /**
//  * @
//  * 获取商品
//  */
// export function getGoodsList(){
// 	let url = '/api/goods/list'
// 	return request.get(url)
// }

/**
 * @
 * 获取所有商品
 */
export function getGoodsSearch(name,page){
	let url = '/api/goods/search'
	// let data = {name}
	// let data = name
	let limit = 6
	let data = {
		name,
		page,
		limit
	}
	console.log(data)
	return request.post(url,data)
}
